package com.xinqi.modules.prepare.question.service;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.modules.prepare.common.dto.data.PrepareQuestionBankData;
import com.xinqi.modules.prepare.paper.dto.req.QuestionTypeNumDTO;
import com.xinqi.common.base.dto.QuestionBaseDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankCopyDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankCreateDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankDeleteDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankEditScoreDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankQueryDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankSortDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankUpdateDTO;
import com.xinqi.modules.prepare.question.dto.rsp.PrepareQuestionBankResultDTO;
import com.xinqi.modules.prepare.question.dto.rsp.PrepareQuestionStatsDataDTO;
import org.springframework.transaction.annotation.Transactional;

import javax.validation.Valid;
import java.util.List;

/**
 * 备课区测评卷试题表服务层
 *
 * @author: system
 * @date: 2023/03/19
 */
public interface PrepareQuestionBankService {
    /**
     * 分页查询 备课区测评卷试题表数据
     */
    PageInfo<PrepareQuestionBankResultDTO> page(Param pageable, PrepareQuestionBankQueryDTO query);

    /**
     * 查询 备课区测评卷试题表数据
     */
    List<PrepareQuestionBankResultDTO> find(PrepareQuestionBankQueryDTO query);

    /**
     * 根据id查询 备课区测评卷试题表数据
     */
    PrepareQuestionBankResultDTO findById(Long id);

    /**
     * 根据id查询 备课区测评卷试题表数据导出
     */
    PrepareQuestionBankData find(Long id);

    /**
     * 新增 备课区测评卷试题表数据
     */
    Long insert(@Valid PrepareQuestionBankCreateDTO dto);

    /**
     * 新增 备课区测评卷试题表数据
     */
    Long insert(@Valid PrepareQuestionBankData dto);

    /**
     * 根据id修改 备课区测评卷试题表数据
     */
    Boolean updateById(@Valid PrepareQuestionBankUpdateDTO dto);

    /**
     * 根据id删除 备课区测评卷试题表数据
     */
    Boolean deleteById(Long id);

    /**
     * 根据id删除 备课区测评卷试题表数据
     */
    Boolean deleteById(PrepareQuestionBankDeleteDTO dto);

    Boolean deleteBatch(Long prepareId, List<Long> ids);

    @Transactional(rollbackFor = Exception.class)
    Boolean editQuestionScore(@Valid PrepareQuestionBankEditScoreDTO dto);

    @Transactional(rollbackFor = Exception.class)
    Boolean sortQuestionBank(@Valid PrepareQuestionBankSortDTO dto);

    PrepareQuestionStatsDataDTO questionStats(Long prepareId);

    @Transactional(rollbackFor = Exception.class)
    Boolean insertBatch(Long prepareId, List<PrepareQuestionBankCreateDTO> list);

    @Transactional(rollbackFor = Exception.class)
    Boolean copy(@Valid PrepareQuestionBankCopyDTO dto);

    List<QuestionBaseDTO> random(Long prepareId, @Valid List<QuestionTypeNumDTO> dto);

    /**
     * 查询 备课区测评卷试题表数据 根据IDS
     */
    List<PrepareQuestionBankResultDTO> findIds(List<Long> ids);
}
